import axios from 'axios'

// 创建 Axios 实例
const myAxios = axios.create({
  baseURL: 'http://localhost:8123/',
  timeout: 60000,
  withCredentials: true
});

// 添加一个请求拦截器
// Add a request interceptor
myAxios.interceptors.request.use(function (config) {
  // Do something before request is sent
  return config;
}, function (error) {
  // Do something with request error
  return Promise.reject(error);
});

// 添加一个回复拦截器
// Add a response interceptor
myAxios.interceptors.response.use(function (response) {
  const { data } = response.data

  console.log(data)
  return response;
}, function (error) {
  return Promise.reject(error);
});

export default myAxios
